package org.example.projecttwo.entity.news;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 新闻基础信息表
 * </p>
 *
 * @author nn
 * @since 2025-11-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("news")
@Schema(name="News对象", description="新闻基础信息表")
public class News implements Serializable {

    private static final long serialVersionUID = 1L;

    @Schema(description = "主键ID（雪花算法）")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    private Long id;

    @Schema(description = "新闻编号")
    @TableField("news_no")
    private String newsNo;

    @Schema(description = "新闻标题")
    @TableField("title")
    private String title;

    @Schema(description = "新闻正文")
    @TableField("content")
    private String content;

    @Schema(description = "封面图片URL")
    @TableField("cover_url")
    private String coverUrl;

    @Schema(description = "发布者用户ID")
    @TableField("author_id")
    private Long authorId;

    @Schema(description = "发布者昵称")
    @TableField("author_nickname")
    private String authorNickname;

    @Schema(description = "发布者头像URL")
    @TableField("author_avatar")
    private String authorAvatar;

    @Schema(description = "状态")
    @TableField("status")
    private Integer status;

    @Schema(description = "实际发布时间")
    @TableField("publish_time")
    private LocalDateTime publishTime;

    @Schema(description = "创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @Schema(description = "最后编辑时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


}